const Controller = require("egg").Controller

class BaseController extends Controller{
    async success(res,status=200){
        const {ctx} = this;
        ctx.body = {code:20000,msg:'success',data:res}
        ctx.status = status
    }
    async error(res){
        const {ctx} = this;
        ctx.body = {code:1,msg:'error',data:res}
        ctx.status = 206
    }
}

module.exports = BaseController